# -*- coding: utf-8 -*-
# 新版1.0
from utils.operators.spark_submit import SparkSubmitOperator

from jms.dim import jms_dim__dim_lmdm_sys_network, jms_dim__dim_lmdm_sys_first_code, jms_dim__dim_lmdm_sys_network_distributi
from jms.ods import jms_ods__tab_barscan_centerarrival, jms_ods__tab_barscan_centersend, \
    jms_ods__tab_barscan_difficult, jms_ods__tab_barscan_unloading, jms_ods__yl_oms_interceptorpiece, jms_ods__yl_oms_oms_waybill, jms_ods__tab_barscan_loading
from jms.ods import jms_ods__yl_tmsnew_tms_shipment, jms_ods__tms_branch_shipment, \
    jms_ods__yl_tmsnew_branch_shipment, jms_ods__yl_tmsnew_branch_shipment_stop

jms_dm__dm_cn_export_center_store_detail_dt = SparkSubmitOperator(
    task_id='jms_dm__dm_cn_export_center_store_detail_dt',
    pool_slots=8,
    task_concurrency=1,  # 如果任务不支持并发，则将 task_concurrency 设为 1
    name='jms_dm__dm_cn_export_center_store_detail_dt_{{ execution_date | date_add(-1) | cst_ds }}',  # yarn 任务名称
    driver_memory='4G',
    executor_memory='12G',
    executor_cores=4,
    num_executors=10,
    email=['lukunming@jtexpress.com','yl_bigdata@yl-scm.com'],
    conf={'spark.executor.memoryOverhead': 4096,
          'spark.core.connection.ack.wait.timeout': 3000,
          'spark.default.parallelism': 600,
          'spark.locality.wait': 60,
          'spark.driver.maxResultSize': 20,
          },
    java_class='com.yunlu.bigdata.jobs.export.ExportCenterStoreDetail',  # spark 主类
    application='hdfs:///scheduler/jms/spark/lyx/center_store/jobs-1.0-SNAPSHOT-jar-with-dependencies.jar',
    # spark jar 包
    application_args=['{{ execution_date | date_add(-1) | cst_ds }}'],
    # 参数dt 2020-10-26
)

# 设置依赖
jms_dm__dm_cn_export_center_store_detail_dt << [
    jms_ods__tab_barscan_centerarrival,
    jms_ods__tab_barscan_centersend,
    jms_ods__yl_tmsnew_tms_shipment,
    jms_ods__yl_oms_interceptorpiece,
    jms_ods__tab_barscan_unloading,
    jms_ods__tms_branch_shipment,
    jms_ods__yl_tmsnew_branch_shipment,
    jms_ods__yl_tmsnew_branch_shipment_stop,
    jms_ods__yl_oms_oms_waybill,
    jms_dim__dim_lmdm_sys_network,
    jms_dim__dim_lmdm_sys_network_distributi,
    jms_dim__dim_lmdm_sys_first_code,
    jms_ods__tab_barscan_loading,
    jms_ods__tab_barscan_difficult,
]
